/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package maze;

/**
 *
 * @author Iskandar Sarkawi
 */
public class Tile {

    private boolean passable; // A tile is passable if there's no obstacle sitting on it
    private boolean occupied; // A tile is occupied if there's a robot sitting on it

    /*
     * Constructor for object of class Tile
     */
    public Tile(){
        passable = true;
        occupied = false;
    }

    public void setPassable(boolean b){
        passable = b;
    }

    public void becomeOccupied(){
        occupied = true;
    }

    public boolean isPassable(){
        return passable;
    }

    public boolean isOccupied(){
        return occupied;
    }

    /*
     * A tile is free when both not occupied and passable
     */
    public boolean isFree(){
        return (!(occupied) && passable);
    }

    public void free(){
        passable = true;
        occupied = false;
    }

}
